/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bea.cliente.character;

import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.AnimEventListener;

/**
 *
 * @author Ivan
 */
public class CharacterAnimControl implements AnimEventListener {

    private AnimControl animControl;
    private AnimChannel animChannelTop;
    private AnimChannel animChannelBase;

    public CharacterAnimControl(AnimControl animControl) {
        super();
        this.animControl = animControl;
    }

    public void init() {
        animChannelBase = animControl.createChannel();
        animChannelTop = animControl.createChannel();
        animControl.addListener(this);

    }

    public AnimControl getAnimControl() {
        return animControl;
    }

    public AnimChannel getAnimChannel() {
        return animChannelBase;
    }

    public String getAnimationName() {
        return animChannelBase.getAnimationName();
    }

    public void setStandAnim() {
        animChannelTop.setAnim("IdleTop", 1f);
        animChannelBase.setAnim("IdleBase", 1f);
    }

    public void setWalkAnim() {
        animChannelTop.setAnim("RunTop", 0.7f);
        animChannelBase.setAnim("RunBase", 0.7f);
    }

    public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
    }

    public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
    }
}
